<?php


namespace app\wechat\validate;


use think\Validate;

class Book extends Validate
{
    protected $rule=[
        'name|书名'=>'require|max:200',
        'author|作者'=>'require|max:100',
        'price|定价'=>'require',
        'img|封面图'=>'require',
        'read_status|状态'=>'require',
        'bookcase_id|书柜'=>'require',
        'source|来源'=>'require',
        'actual_price|实际购入价格'=>'require',
        'own_date|拥有日期'=>'require',
    ];
    protected $message=[
        'name.require'=>'请填写书名',
        'name.max'=>'书名过长',
        'author.require'=>'请输入作者',
        'author.max'=>'作者名称过长',
        'price.require'=>'请填写定价',
        'img.require'=>'请上传封面',
        'read_status.require'=>'请选择阅读状态',
        'bookcase_id.require'=>'请选择书柜',
        'source.require'=>'请选择来源',
        'actual_price.require'=>'请填写实际购入价格',
        'own_date.require'=>'选择拥有日期',
    ];
    protected $scene=[
        'add_book'=>['name','author','price','img','read_status','bookcase_id','source','actual_price','own_date'],
    ];
}